const mongoose = require("mongoose");

const schema = new mongoose.Schema({//商品集合(articles)
    name: String,//商品名
    desc: String,//商品描述
    price: Number,//商品价格
    status: Boolean,//商品的购买状态
    images: [String],//商品的图片,每一项是图片路径字符串
    check: Number,//商品的审核状态，0:未通过，1:待审核,2：通过
    time: Date,//商品的上架时间戳
    type: String,//
    f_count: [
        {//收藏的用户集合
            type: mongoose.Schema.Types.ObjectId,
            ref: "users"
        },
    ],
    userId: {
        //发布的用户
        type: mongoose.Schema.Types.ObjectId,
        ref: "users"

    }
})
mongoose.model("articles", schema, "articles");